package cn.ecpay;

import org.springframework.amqp.core.Queue;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@ComponentScan("cn.ecpay.*")
@ServletComponentScan(basePackages = "cn.ecpay.*")
@EnableScheduling
public class UnionpaySettleApplication extends SpringBootServletInitializer {

	private static final String UNION_FORWARDING_NOTIFY  = "unionpay-forwarding-notify";

	public static void main(String[] args) {
		SpringApplication.run(UnionpaySettleApplication.class, args);
	}

	@Bean(name="forwardingnotify")
	public Queue forwardingNotifyQueue() {
		return new Queue(UNION_FORWARDING_NOTIFY);
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(UnionpaySettleApplication.class);
	}
}
